//
//  TJNetworking.h
//  BaoDian
//
//  Created by mac on 2024/8/4.
//

#import <Foundation/Foundation.h>
#import <AFNetworking.h>

NS_ASSUME_NONNULL_BEGIN

@interface TJNetworking : NSObject

+ (TJNetworking *)shareNetwork;

- (void)POST:(NSString *)url
  parameters:(nullable id)parameters
     success:(void (^__nullable)(NSDictionary *responseObject, id data))success
     failure:(void (^__nullable)(NSError *error))failure;

- (void)POSTBodyJSON:(NSString *)url
  parameters:(nullable id)parameters
     success:(void (^__nullable)(NSDictionary *responseObject, id data))success
     failure:(void (^__nullable)(NSError *error))failure;

- (void)GET:(NSString *)url
 parameters:(nullable id)parameters
    success:(void (^__nullable)(NSDictionary *responseObject, id data))success
    failure:(void (^__nullable)(NSError *error))failure;

- (void)uploadFileWithURL:(NSString *)url
                 fileData:(NSData *)fileData
                  fileKey:(NSString *)fileKey
                 fileName:(NSString *)fileName
                 mimeType:(NSString *)mimeType
               parameters:(nullable id)parameters
                  success:(void (^)(NSDictionary *, id data))success
                  failure:(void (^)(NSError *error))failure;

AFHTTPSessionManager * getBodyJsonHTTPSessionManager(void);
NSURLSessionDownloadTask * TJDownloadFileWithUrl(NSString *url,void (^progress)(CGFloat value), NSURL *(^destination)(void), void (^complete)(NSError * _Nullable error)) ;
NSURLSessionUploadTask * TJUploadFileWithLocalPath(NSString *localPath, NSString *destinationPath, void (^progress)(CGFloat value), void (^complete)(NSError * _Nullable error, NSString * _Nullable ocId, NSDate * _Nullable date));

@end

NS_ASSUME_NONNULL_END
